package com.air.designmodel.eleven;

/**
 * 抽象出来的模板方法类
 *
 * @author shent
 */
public abstract class CaffeineBeverage {
    void prepareRecipe() {
        boilWater();
        brew();
        pourInCup();
        //钩子
        if (customerWantsCondiments()) {
            addCondiments();
        }
    }

    abstract void brew();

    abstract void addCondiments();

    void boilWater() {
        System.out.println("boiling water");
    }

    void pourInCup() {
        System.out.println("pouring into cup");
    }

    boolean customerWantsCondiments() {
        return false;
    }


}
